<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    [v-cloak] {
      display: none;
    }
  </style>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
</head>

<body>
  <div id="app">

    <h1 style="color: red">动态绑定行内样式</h1>
    <h1 :style="{fontSize:a6,color:'blue'}">动态绑定行内样式</h1>
    <h1 :style="`font-size:${a6};color:gold`">动态绑定行内样式</h1>
    <h1 :style="[{color:'red'},{fontSize:a7+'px'},{textDecoration:'line-through'}]">动态绑定行内样式</h1>
    <h1 :style="{[a8]:a5}">动态绑定行内样式</h1>

    </h1>



    <hr>



    <h1 :class="a3">动态绑定样式</h1>
    <h1 :class="[a3,a4]">动态绑定样式</h1>
    <h1 :class="`${a3} ${a4}`">动态绑定样式</h1>
    <h1 :class="{'box':false}">动态绑定样式</h1>
    <h1 :class="{box:true}">动态绑定样式</h1>
    <h1 :class="[a3,(2>1?'box1':'box2')]">动态绑定样式</h1>
    <h1 :class="{'box':Math.random()>0.5}">动态绑定样式</h1>
    <h1 :class="{'box':123}">动态绑定样式</h1>


    <hr>


    <h2 v-bind:title="a1">我是h2</h2>
    <h2 :title="a1">我是h2</h2>
    <h2 :title="a1" :class="a2">我是h2</h2>
    <h2 v-bind="{title:a1,class:a2}">我是h2</h2>


    <hr>


    <h2 v-cloak>{{name}}</h2>
    <h2 v-text="name"></h2>
    <h2 v-text="'年龄：'+age"></h2>
    <h2 v-text=`年龄：${age}`></h2>
    <h2>{{'年龄：'+age}}</h2>
    <h2 v-text="msg"></h2>
    <h2 v-html="msg"></h2>

  </div>
  <script>
    // setTimeout(() => {
    let vm = new Vue({
      el: "#app",
      data() {
        return {
          name: "码路",
          age: 18,
          msg: `<a href="http://www.baidu.com">百度一下</a>`,
          a1: 'ok',
          a2: 'bad',
          a3: "a33",
          a4: "a44",
          a5: "blue",
          a6: "38px",
          a7: 80,
          a8: "color"
        }
      }
    });
    // }, 2000)
  </script>
</body>

</html>